﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
	<title></title>
	<script language="javascript">
		function divPage(type){
	        var to_page;
	        if(type==1){
	        	to_page = 1;
	        }else if(type==2){
	        	to_page = parseInt(document.getElementById('currentPage').value) - 1; 
	        }else if(type==3){
	        	to_page = parseInt(document.getElementById('currentPage').value) + 1;
	        }else if(type==4){
	        	to_page = parseInt(document.getElementById('pageCount').value);
	        }else if(type==5){
	        	if(document.getElementById('selPage').value.length==0){
	        		return ;
	        	}
	        	to_page = parseInt(document.getElementById('selPage').value);
	        }
	        if(to_page < 1){
	        	to_page = 1;
	        }
	        if(to_page > parseInt(document.getElementById('pageCount').value)){
	        	to_page = parseInt(document.getElementById('pageCount').value);
	        }
	        document.getElementById('currentPage').value = to_page;
	        document.getElementById('pageForm').submit();
	    }
	    //只允许输入的值是否为0--9，左向方向键及删除键
		function checkCharIsNumber(){
			if(event.keyCode==13){//回车键
				divPage(5);
				return false;
			}else if((event.keyCode<=57&&event.keyCode>=48)||(event.keyCode<=105&&event.keyCode>=96)||
				(event.keyCode==8||event.keyCode==37||event.keyCode==39)){
				return true;
			}else{
				return false;
			}
		}
	</script>
</head>
<body>
	<input type="hidden" id="currentPage" name="currentPage" value="${page.currentPage}">
	<input type="hidden" id="pageCount" name="pageCount" value="${page.pageCount}">
	<input type="hidden" id="pageSize" name="pageSize" value="${page.pageSize }">
	<div align="right" style="padding-right:10px;">
		一共<span class="pageCount" style="font-weight:bold;">${page.recordCount }</span>条记录&nbsp;&nbsp;&nbsp;&nbsp;
		<c:choose>
			<c:when test="${page.currentPage<=1}">
				<a class="pageCountP">首页</a>&nbsp;&nbsp;&nbsp;
				<a class="pageCountP">上一页</a>&nbsp;&nbsp;&nbsp;
			</c:when>
			<c:otherwise>
				<a class="pageCount" href="javascript:divPage(1);">首页</a>&nbsp;&nbsp;&nbsp;
				<a class="pageCount" href="javascript:divPage(2);">上一页</a>&nbsp;&nbsp;&nbsp;
			</c:otherwise>
		</c:choose>
		<c:choose>
			<c:when test="${page.currentPage >= page.pageCount}">
				<a class="pageCountP">下一页</a>&nbsp;&nbsp;&nbsp;
				<a class="pageCountP">末页</a>&nbsp;&nbsp;&nbsp;
			</c:when>
			<c:otherwise>
				<a class="pageCount" href="javascript:divPage(3);">下一页</a>&nbsp;&nbsp;&nbsp;
				<a class="pageCount" href="javascript:divPage(4);">末页</a>&nbsp;&nbsp;&nbsp;
			</c:otherwise>
		</c:choose>
		<input id="selPage" class="pagePage" size="6" value="${page.currentPage }/${page.pageCount }" onclick="JavaScript:this.value='';" onkeydown="return checkCharIsNumber();">
		   <input type="button" class="pageGo" onclick="javascript:divPage(5);" />		
	</div>
</body>
</html>
